<template>
  <div id="EquipmentBookingSystem">
    <div class="child-system-header">
      <div
        @click="handleMenuClick('EquipmentAlarm')"
        :class="activeMenu === 'EquipmentAlarm' ? 'active' : ''"
        class="menu-item"
      >
        设备告警消息
      </div>
      <div
        @click="handleMenuClick('SystemNotify')"
        :class="activeMenu === 'SystemNotify' ? 'active' : ''"
        class="menu-item"
      >
        系统消息
      </div>
    </div>
    <div class="child-system-content">
      <EquipmentAlarm v-if="activeMenu === 'EquipmentAlarm'" />
      <SystemNotify v-if="activeMenu === 'SystemNotify'" />
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { useRoute } from "vue-router";
import EquipmentAlarm from "./EquipmentAlarm.vue";
import SystemNotify from "./SystemNotify.vue";

const route = useRoute();
// 获取当前菜单
const activeMenu = ref(route.name as string);
// 菜单点击
function handleMenuClick(menuName: string) {
  activeMenu.value = menuName;
}
</script>

<style scoped lang="scss">
#EquipmentBookingSystem {
  width: 100%;
  height: 100%;
}
.child-system-header {
  display: flex;
  align-items: center;
  height: 5rem;
  padding: 0 1.5rem;
  background-color: rgba($color-brand, 0.1);
  border-radius: 5px;
  .menu-item {
    margin-right: 6rem;
    font-size: $font-size-page-menu;
    color: $text-color-secondary;
    cursor: pointer;
    border-bottom: 3px solid transparent;
  }
  .menu-item.active {
    color: $text-color-primary;
    border-bottom: 3px solid $color-brand;
  }
}
.child-system-content {
  height: calc(100% - 5rem);
}
</style>
